The present invention relates to demodulation of pulse code bit cells, and more particularly to a compensation technique and apparatus for correctly demodulating a pulse code bit cell whose high and low periods have been distorted.
A remote control unit permits a user to operate a device from a location that is at some distance from the device. Wireless remote control units dispense with the need for the unit to be physically cabled to the device to be controlled, and therefore provide additional convenience to the user. Consumers are now familiar with the use of wireless remote control units for controlling many of their home devices, such as audio and video equipment. Furthermore, the benefits offered from wireless remote control continue to provide motivation for imbedding this feature into other types of devices, such as personal computers.
A typical remote control unit operates by transmitting a beam of infrared light to a receiver located at or near the device to be controlled. It is usually necessary for the infrared light to be encoded with information that identifies the particular function requested by the user. This is typically accomplished by mapping each function to a unique string of "0's" and "1's" and then using a form of pulse width modulation (PWM) to encode these "0's" and "1's" into the transmitted infrared light beam. At the device, an infrared interface receives the modulated infrared light beam, and then demodulates the beam to recover the "0's" and "1's" and, in turn, identify the command to be performed.
In pulse width modulation, a pulse carrier is modulated in a manner wherein the value to be encoded (in this case, either a "0" or a "1") produces a pulse of proportional duration. FIGS. 1a and 1c illustrate modulated pulses. FIG. 1a depicts a bit cell that has been modulated to correspond to the digit "0". The bit cell consists of a high period 101 and a low period 103. The duration of the high period 101 is T1, and the duration of the low period 103 is T2, which, in this case, is equal to T1.
FIG. 1c depicts a bit cell that has been modulated to correspond to the digit "1". This bit cell also has a high period 101' and a low period 103'. In this type of encoding, the high period is fixed, so that the duration of high period 101' is T1, just as in the encoding of the digit "0". However, unlike the bit cell of FIG. 1a, the bit cell of FIG. 1c has a low period 103' that is twice as long as the duration of the high period 101' That is, for the encoding of the digit "1" T2'=2.times.T1'=2.times.T1. Consequently, the binary value of any given bit cell can be determined by evaluating the ratio of low versus high periods of the bit cell. If the low period has a duration equal to the high period, then the encoded digit is a "0". Otherwise, if the duration of the low period is twice as long as that of the high period, then the encoded digit is a "1".
A known method for evaluating a bit cell is to begin counting up from zero, at a first fixed repetition rate, during the high period of the bit cell. Then, during the low period of the bit cell, this count is decreased by one at a second, slower repetition rate so that the time period between each decrement (the "count-down interval"), represented by T.sub.DOWN, is 50% longer than the time period between each of the previous increments (the "count-up interval"), represented by T.sub.UP. At the end of the bit cell, the sign of the resulting count corresponds to the value that was encoded in the bit cell. That is, if the resulting count is positive, then the bit cell represented the value "0". If the resulting count is negative, then the bit cell represented the value "1".
This is illustrated in FIGS. 1b and 1d, which depict the counting operations for corresponding bit cells depicted in FIGS. 1a and 1c, respectively. In FIG. 1b, the count begins at zero, and counts up during the high period 101 at a rate equal to RATE.sub.UP =1/T.sub.UP, until a count equal to COUNT.sub.HIGH =T1.times.RATE.sub.UP =T1/T.sub.UP is reached. Then the count is decreased by one during the low period 103 at a rate equal to RATE.sub.DOWN =1/T.sub.DOWN, until a final count equal to COUNT.sub.LOW =COUNT.sub.HIGH -(T2.times.RATE.sub.DOWN)=COUNT.sub.HIGH -T1/T.sub.DOWN is reached. Because T.sub.DOWN =T.sub.UP +(T.sub.UP /2), and T2=T1, this count will be positive, indicating that the bit cell was encoded as a value "0".
Similarly, FIG. 1d illustrates the counting operation for the bit cell shown in FIG. 1c. In FIG. 1d, the count also begins at zero, and counts up during the high period 101' at a rate equal to RATE.sub.UP =1/T.sub.UP, until a count equal to COUNT.sub.HIGH '=T1'.times.RATE.sub.UP =T1'/T.sub.UP is reached. Then, during the low period 103' the count is decreased by one at a rate equal to RATE.sub.DOWN =1/T.sub.DOWN, until a final count equal to ##EQU1## is reached Because T.sub.DOWN =T.sub.UP +(T.sub.UP /2), and Ti'=T1, this count will be negative, indicating that the bit cell was encoded as a value "1".
In practice, the modulated infrared light beam is usually transmitted as a binary data stream which is preceded by an Automatic Gain Control (AGC) burst. The purpose of the AGC burst is to provide an AGC circuit, which is located in the infrared detector, with a sample signal so that the gain of the receiver will be set properly for correct detection of the data stream. Infrared data formats typically require that data be repeated so that erroneous evaluation of the data stream can be avoided by discarding data that does not match previously transmitted data. Typically, three successive data streams must be evaluated to produce the same result before that data is accepted as being valid.
A problem with the above-described prior art technique is that errors in data stream evaluation can be introduced as a result of incorrect initial gain settings in the AGC hardware. When this happens, the period of the high portion of the received bit cell becomes shorter while the low portion of the bit cell becomes longer. The lengthening of the low portion of the cell is approximately equal to the period by which the high portion is shortened, so that the duration of the entire bit cell remains approximately constant. It may also be possible for the AGC circuit to produce timing errors in the opposite direction, so that the high portion of the received bit cell becomes longer than that of the transmitted bit cell, and the low portion of the received bit cell becomes shorter.
When this type of error occurs, the duration of the count-up operation is affected, causing the COUNT.sub.HIGH value to be incorrect. This, combined with an incorrect count-down duration, then causes the final COUNT.sub.LOW value to be wrong. If the COUNT.sub.LOW value has the wrong sign, then the bit-cell will be wrongly evaluated.
This problem reoccurs until the data stream has been repeated a sufficient number of times so that the AGC circuit stabilizes at the correct gain amount. The number of iterations required to stabilize the AGC circuit varies with signal quality. It has been observed that the first two data streams are rarely evaluated properly using the standard evaluation methodology described above.